import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue"

Vue.use(VueRouter);

const routes=[

      {
         path: "/",
         name: "/",
         component: Home,
         children:[
           {
               path: "home",
               component: () =>
                    import( /* webpackChunkName: "HomeItem" */ "../views/HomeItem.vue"),
           },
           {
               path: "type",
               component: () =>
                   import( /* webpackChunkName: "Type" */ "../views/Type.vue"),
           },
           {
               path: "user",
               component: () =>
                   import( /* webpackChunkName: "User" */ "../views/User.vue"),
           },
           {
               path: "role",
               component: () =>
                   import( /* webpackChunkName: "Role" */ "../views/Role.vue"),
           },
           {
               path: "product",
               component: () =>
                   import( /* webpackChunkName: "Product" */ "../views/Product.vue"),
                children:[
                    {
                        path: "productlist",
                        component: () =>
                            import( /* webpackChunkName: "ProductList" */ "../views/ProductList.vue"),
                    },
                    {
                        path: "addproduct",
                        name:"addproduct",
                        component: () =>
                            import( /* webpackChunkName: "AddProduct" */ "../views/AddProduct.vue"),
                    },
                    {
                        path: "productDetail/:id",
                        name:"productDetail",
                        component: () =>
                            import( /* webpackChunkName: "ProductDetail" */ "../views/ProductDetail.vue"),
                    },

                ]
           },
           {
               path: "spec",
               component: () =>
                   import( /* webpackChunkName: "Spec" */ "../views/Spec.vue"),
           },
           {
               path: "order",
               component: () =>
                   import( /* webpackChunkName: "Order" */ "../views/Order.vue"),
                children:[{
                    path: "orderDetail/:id",
                    name: "orderDetail",
                    component: () =>
                        import( /* webpackChunkName: "OrderDetail" */ "../views/OrderDetail.vue"),
                        params:true
                },
                {
                    path: "orderList",
                    component: () =>
                        import( /* webpackChunkName: "OrderList" */ "../views/OrderList.vue"),
                }
            ],
           },
           
       ]
    },
    {
        path: "/login",
        component: () =>
            import( /* webpackChunkName: "Login" */ "../views/Login.vue"),
    }
    
]

const router = new VueRouter({
    routes,
});
export default router;